/*********************************************************************
* File: mathLibrary.h
*
* \brief Miscellaneous mathematical functions.
*
* \author Instituto Superior Tecnico de Lisboa, Portugal
* \author Technical University of Lisbon, Portugal
* 
* \author Agentes Autonomos e Sistemas Multiagente
* \author Autonomous Agents and Multiagent Systems
* 
* \version	1.0
* \date		2006/2007
*********************************************************************/
#pragma once

#include "../engine.h"

#pragma warning (disable: 4239)

namespace util{ namespace math {
	//=============================================================================
	// Defines and constants
	//=============================================================================
	/** 
	* \brief Equality tolerance.
	**/
#define EQUAL_EPSILON     0.001
	/** 
	* \brief Whether two numbers are equal to within EQUAL_EPSILON.
	**/
#define FEqual(v1, v2) ( fabs(v1 - v2) < EQUAL_EPSILON )

	//=============================================================================
	// Function prototypes
	//=============================================================================
	float lengthSquared(const Vector &vec);
	float angleMod(float a);
	float angleNormalize(float angle);
	void clampAngles(Vector &vecAngles);
	void sinCos( float rad, float *flSin, float *flCos );
	float angleDifference( float destAngle, float srcAngle );
	float vectorToYaw( const Vector &vec );
	Vector vectorToAngles( const Vector &vec );
	void makeVectors( const Vector &vecAngles );
	int ceiling(float value);
	bool compareVectors(Vector v1, Vector v2, float precision);
}}
